#include <iostream>
//#include <string>

using namespace std;

int main()
{
    int n;
	for(cin>>n;n>0;n--)
    {
		int N,k;
		cin>>N>>k;
		long long rt=1;
		for(int i=N-k;i>0;i--)
			rt*=2;
		cout<<rt<<endl;
    }
//	system("PAUSE");
	return 0;
}
